#include <stdio.h>
#include <math.h>
int main()
{
    int z, y, x;
    for (x = 1; x <= 3; x++)
        for (y = 1; y <= 3; y++)
            for (z = 1; z <= 3; z++)
                if (x != 1 && x != 3 && z != 3 && x != y && x != z && y != z)
                {
                    printf("X will marry to %c\n", 'A' + x - 1);
                    printf("Y will marry to %c\n", 'A' + y - 1);
                    printf("Z will marry to %c\n", 'A' + z - 1);
                }
}